<?php

namespace common\models\admin;

use Yii;

/**
 * This is the model class for table "{{%auth_user_company}}".
 *
 * @property int $id
 * @property int $user_id
 * @property int $company_id
 * @property int $current
 * @property int $status 状态
 * @property int $created_at 创建时间
 * @property int $updated_at 更新时间
 */
class AdminUserCompany extends \common\db\ActiveRecord {

    /**
     * {@inheritdoc}
     */
    public static function tableName() {
        return '{{%auth_user_company}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules() {
        return [
            [['user_id', 'company_id', 'current', 'status', 'created_at', 'updated_at'], 'integer'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'user_id' => 'User ID',
            'company_id' => 'Company ID',
            'current' => 'Current',
            'status' => '状态',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
        ];
    }

    public function getCompany() {
        return $this->hasOne(\common\models\hotel\Hotel::class, ['id' => 'company_id']);
    }

}
